﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;

namespace Innoapps.FileTransfer.Models
{
    [XmlRoot("Settings")]
    public class Settings
    {

        #region Constructors
        public Settings()
        {
            CacheProvider = new Providers.Cache.FileSystem()
            {
                FolderPath = Path.Combine(Path.GetTempPath(),"BizRouteCache")
            };
            StateProvider = new Providers.State.InProcess()
            {
                RoutingFolder = Path.Combine(Path.GetTempPath(), "BizRouteRouting")
            };
            InputProviders = new List<Providers.Input.Base>()
            {
                new Providers.Input.FileSystem()
                {
                    FolderPath = Environment.CurrentDirectory,
                    Filter = "*.xml"
                }
            };
        }
        #endregion

        #region Variables
            private int initialWorkerThreads = 5;
            private int maximumWorkerThreads = 25;
            private int initialTransferThreads = 5;
            private int maximumTransferThreads = 5;
        #endregion

        #region Properties

        [XmlElement("CacheProvider")]
        public Providers.Cache.Base CacheProvider { get; set; }
        [XmlElement("StateProvider")]
        public Providers.State.Base StateProvider { get; set; }
        [XmlArray("OutputProviders")]
        public List<Providers.Output.Base> OutputProviders { get; set; }
        [XmlArray("InputProviders")]
        public List<Providers.Input.Base> InputProviders { get; set; }
        [XmlArray("LogProviders")]
        public List<Providers.Log.Base> LogProviders { get; set; }
        [XmlAttribute("InitialWorkerThreads")]
        public int InitialWorkerThreads { get { return initialWorkerThreads; } set { initialWorkerThreads = value; } }
        [XmlAttribute("MaximumWorkerThreads")]
        public int MaximumWorkerThreads { get { return maximumWorkerThreads; } set { maximumWorkerThreads = value; } }
        [XmlAttribute("InitialTransferThreads")]
        public int InitialTransferThreads { get { return initialTransferThreads; } set { initialTransferThreads = value; } }
        [XmlAttribute("MaximumTransferThreads")]
        public int MaximumTransferThreads { get { return maximumTransferThreads; } set { maximumTransferThreads = value; } }

        #endregion
    }
}
